<?php

/**
 * @author Terry & 千里孤坟
 * @copyright 2009
 */



/**
* 针对Char属性改变的类
* 事前结算
*/

class BeforeStatus {
	
	public function __construct(){
		$this->id = -1;
		$this->on = 0;		//开关
		$this->name = "基类";
		$this->time = 3;	//持续回合数，99即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function start($a,$b,$sk){
		$this->action($a);
	}
	
	public function action($a) {				
		return 0;
	}
	
	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->before_status[$this->id]->time = 3;
	}	
}

class Up extends BeforeStatus {
	
	public function __construct(){
		$this->id = 0;
		$this->on = 0;		//开关
		$this->name = "倒地";
		$this->time = 0;	//持续回合数，99即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$s = $a->name."爬起来了。<br>";
		$this->cancel($a);
		$a->defskill_status[0]->cancel($a);
		$_SESSION['show'] .= $s;		
		return 0;
	}
}

class ShunJianHuiFu extends BeforeStatus {
	
	public function __construct(){
		$this->id = 1;		/** 优先级需要在所有异常之前 **/
		$this->on = 0;		//开关
		$this->name = "瞬間回復";
		$this->time = 0;	//持续回合数，99即作为永久
		$this->n = 0;		//当前进行次数
		$this->permanent = 1;	//持久效果
		$this->nohint = 1;	//状态栏中无提示
	}
	
	public function action($a) {
		$t = mt_rand(1,100);
		$_SESSION['result'] .= $this->name."乱数：$t<br>";
		if($abn = StatusHelper::has_abn($a) > 0 && $a->luk >= $t) {
			global $g_mental_spt;
			StatusHelper::cure_allspt($a);
			$_SESSION['show'] .= $a->name."的".$this->name."发动，身上的所有异常都自动解除了。<br>";
			StatusHelper::sky_thorne($a);	//天之王座
			return 0;				
		}
	}
}

class UnDef extends BeforeStatus {
	
	public function __construct(){
		$this->id = 2;
		$this->on = 0;		//开关
		$this->name = "防御";
		$this->time = 0;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->cancel($a);
		return 0;
	}
	public function cancel($a) {		
		$a->before_status[$this->id]->on = 0;
		$a->defskill_status[3]->cancel($a);	
	}	
	
}

class StrUp20 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 3;
		$this->on = 0;		//开关
		$this->name = "力上升";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."力上升第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."力上升恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->str = ($a->str-$this->v>0) ? $a->str-$this->v : 0;
		$a->before_status[$this->id]->time = 3;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}

}

class StrDown20 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 4;
		$this->on = 0;		//开关
		$this->name = "力下降";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."力下降第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."力下降恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->str += $this->v;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->before_status[$this->id]->time = 3;
	}
}

class MgrUp20 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 5;
		$this->on = 0;		//开关
		$this->name = "魔上升";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."魔上升第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."魔上升恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->mgr = ($a->mgr-$this->v>0) ? $a->mgr-$this->v : 0;
		$a->before_status[$this->id]->time = 3;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class MgrDown20 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 6;
		$this->on = 0;		//开关
		$this->name = "魔下降";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."魔下降第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."魔下降恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->mgr += $this->v;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class SpdUp20 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 7;
		$this->on = 0;		//开关
		$this->name = "速上升";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."速上升第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."速上升恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->spd = ($a->spd-$this->v>0) ? $a->spd-$this->v : 0;
		$a->before_status[$this->id]->time = 3;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}

}

class SpdDown20 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 8;
		$this->on = 0;		//开关
		$this->name = "速下降";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."速下降第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."速下降恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->spd += $this->v;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class VitUp20 extends BeforeStatus {

	public function __construct(){
		$this->id = 9;
		$this->on = 0;		//开关
		$this->name = "耐上升";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."耐上升第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."耐上升恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->vit = ($a->vit-$this->v>0) ? $a->vit-$this->v : 0;
		$a->before_status[$this->id]->time = 3;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class VitDown20 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 10;
		$this->on = 0;		//开关
		$this->name = "耐下降";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."耐下降第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."耐下降恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->vit += $this->v;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class AllUp20 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 11;
		$this->on = 0;		//开关
		$this->name = "全能力上升";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."全能力上升第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."全能力上升恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->str = ($a->str-$this->v>0) ? $a->str-$this->v : 0;
		$a->mgr = ($a->mgr-$this->v>0) ? $a->mgr-$this->v : 0;
		$a->spd = ($a->spd-$this->v>0) ? $a->spd-$this->v : 0;
		$a->vit = ($a->vit-$this->v>0) ? $a->vit-$this->v : 0;
		
		$a->before_status[$this->id]->time = 3;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class AllDown20 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 12;
		$this->on = 0;		//开关
		$this->name = "全能力下降";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."全能力下降第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."全能力下降恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->str += $this->v;
		$a->mgr += $this->v;
		$a->spd += $this->v;
		$a->vit += $this->v;
		
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class AllUp30 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 13;
		$this->on = 0;		//开关
		$this->name = "全能力上升30";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."全能力上升30第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."全能力上升30恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->str = ($a->str-30)>0 ? $a->str-30 : 0 ;
		$a->mgr = ($a->mgr-30)>0 ? $a->mgr-30 : 0 ;
		$a->spd = ($a->spd-30)>0 ? $a->spd-30 : 0 ;
		$a->vit = ($a->vit-30)>0 ? $a->vit-30 : 0 ;
		
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class StrUp30 extends BeforeStatus {

	public function __construct(){
		$this->id = 14;
		$this->on = 0;		//开关
		$this->name = "力上升30";
		$this->time = 2;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name.$this->name."第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name.$this->name."效果恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->str = ($a->str-30>0) ? $a->str-30 : 0;
		$a->before_status[$this->id]->time = 3;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}

}

class MgrUp30 extends BeforeStatus {

	public function __construct(){
		$this->id = 15;
		$this->on = 0;		//开关
		$this->name = "魔上升30";
		$this->time = 2;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name.$this->name."第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name.$this->name."效果恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->mgr = ($a->mgr-30>0) ? $a->mgr-30 : 0;
		$a->before_status[$this->id]->time = 3;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class SpdUp30 extends BeforeStatus {

	public function __construct(){
		$this->id = 16;
		$this->on = 0;		//开关
		$this->name = "速上升30";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name.$this->name."第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name.$this->name."效果恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->spd = ($a->spd-30>0) ? $a->spd-30 : 0;
		$a->before_status[$this->id]->time = 3;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class Rouse extends BeforeStatus {

	public function __construct(){
		$this->id = 17;
		$this->on = 1;		//觉醒是常时判断的
		$this->started = 0;
		$this->name = "觉醒";
		$this->permanent = 1;
		$this->nohint = 1;
		$this->time = 999;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a,$force=0) {
		$hp_throttle = ($_SESSION['T'] == 11) ? 0.2 : 0.1;
		if($force == 0) {
			if($a->hp >= floor($a->mxhp * $hp_throttle)) return 0;
		}
		if($this->started == 1) return 0;
		$_SESSION['show'] .= $a->name."觉醒！<br>";
		if($a->cid == 1) {
			CalHelper::spec_talk($this,10,"仏光普照，这便是涅槃的前兆！");
			CalHelper::cgdisplay('teaplum_8.jpg');
		} elseif($a->cid == 143) {
			CalHelper::spec_talk($this,1,"我听到了呼唤着我的声音，我听到了“米拉”的声音");
			CalHelper::cgdisplay('snowfly_aw.jpg');
		} elseif($a->cid == 36) {
			CalHelper::spec_talk($this,2,"胜负才刚刚开始呢！");
			CalHelper::cgdisplay('lonelywave_5.jpg');
		} elseif($a->cid == 123) {
			CalHelper::spec_talk($this,3,"光芒在闪耀，那把剑正是古往今来所有战士们所拥有的悲哀与尊贵的梦想<br>以高举此意志为傲，以贯彻此信义为志！");
			CalHelper::cgdisplay('slili_arise.jpg');
		} elseif($a->cid == 128) {
			CalHelper::spec_talk($this,4,"死也要拖你一起下地狱！");
			CalHelper::cgdisplay('nm_8.jpg');
		} elseif($a->cid == 9) {
			CalHelper::spec_talk($this,5,"狂宴的时候到了！挣扎吧，痛苦吧，相爱相杀吧！！");
			CalHelper::cgdisplay('wbook_ar.jpg');
		} elseif($a->cid == 85) {
			CalHelper::spec_talk($this,6,".........Live ! I will live !!!<br>Even if I go to hell,I will live till the end of world.<br>If the world won't go to the end.<br>I will destroy it with my own hand！");
			CalHelper::cgdisplay('cancer_5.jpg');
		} elseif($a->cid == 146) {
			CalHelper::spec_talk($this,7,"决战时刻到了！");
		} elseif($a->cid == 120) {
			CalHelper::spec_talk($this,8,"现在还不是倒下的时候！");
			CalHelper::cgdisplay('xp_arise.jpg');
		} elseif($a->cid == 141) {
			CalHelper::spec_talk($this,9,"El Shaddai！");
			CalHelper::cgdisplay('guiwood_aw.jpg');
		} elseif($a->cid == 43) {
			CalHelper::spec_talk($this,11,"还不能倒下……古之力110%！");
			CalHelper::cgdisplay('lili_7.jpg');
		} elseif($a->cid == 7) {
			CalHelper::spec_talk($this,12,'居然被逼到这地步……好吧，决战时刻！<br>');
		} elseif($a->cid == 105) {
			CalHelper::cgdisplay('gsilver_arise.jpg');
		}
		$rousesp = 75;
		$rouseattr = 10;
		if($_SESSION['T'] == 8) {	//巴特农神庙
			$rousesp *= 2;
			$rouseattr *= 2;
			$_SESSION['result'] .= $a->name."觉醒能力加倍，SP恢复量加倍<br>";
		} elseif($_SESSION['T'] == 11) {	//秦始皇陵墓
			$rousesp = floor($rousesp/2);
			$rouseattr = floor($rouseattr/2);
			$_SESSION['result'] .= $a->name."觉醒能力减半，SP恢复量减半<br>";
		}
		if($this->started == 0) {
			$a->sp = ($a->sp + $rousesp > $a->mxsp) ? $a->mxsp : ($a->sp + $rousesp);
			$a->str += $rouseattr;
			$a->mgr += $rouseattr;
			$a->spd += $rouseattr;
			$a->vit += $rouseattr;
			$this->started = 1;
			$this->nohint = 0;
			$this->permanent = 0;
			$a->defafter_status[3]->on = 1;	//觉醒后状态
			$a->atkskill_status[6]->on = 1;	//觉醒中状态
			$a->defskill_status[25]->on = 1; //觉醒中状态
		}
		if(CalHelper::ifgroupskill($a) == 1 && !$a->rouseskcount) {
			$_SESSION['show'] .= $a->name."魔力覚醒发动，魔力提升。<br>";
			$a->before_status[68]->on = 1;
			$a->mgr += 15;
			$a->rouseskcount += 1;
		} elseif(CalHelper::ifgroupskill($a) == 7 && !$a->rouseskcount) {
			$_SESSION['show'] .= $a->name."修羅の業发动，力量提升。<br>";
			$a->before_status[69]->on = 1;
			$a->str += 15;
			$a->rouseskcount += 1;
		}
	}
	
	public function cancel($a) {
		$a->str -= 10;
		$a->mgr -= 10;
		$a->spd -= 10;
		$a->vit -= 10;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->before_status[$this->id]->started = 0;
	}

}

class AllUp50 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 19;
		$this->on = 0;		//开关
		$this->name = "全能力上升50";
		$this->time = 5;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."全能力上升50第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."全能力上升50恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->str = ($a->str-50)>0 ? $a->str-50 : 0 ;
		$a->mgr = ($a->mgr-50)>0 ? $a->mgr-50 : 0 ;
		$a->spd = ($a->spd-50)>0 ? $a->spd-50 : 0 ;
		$a->vit = ($a->vit-50)>0 ? $a->vit-50 : 0 ;
		
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}

}

class Poison extends BeforeStatus {
	
	public function __construct(){
		$this->id = 20;
		$this->on = 0;		//开关
		$this->name = "中毒";
		$this->time = 3;	//持续回合数，99即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		if(CalHelper::ifgroupskill($a) == 0 && $this->n == 0) {
			$_SESSION['show'] .= "英雄の印发动，异常时效缩短一回合。<br>";
			$this->time = 2;
		}
		$this->n++;		
		if($this->n <= $this->time)	{
			$h = round($a->hp * 0.13);
			if($h >= $a->hp) {
				$h = $a->hp - 1;
			}
			$s = $a->name."身上的毒性发作了！（第".$this->n."回合)。<br>";
			$_SESSION['result'] .= "损失HP:".$h."，损失AP：2<br>";
			CalHelper::apply_damage($a,$a,0,$h);
			CalHelper::apointchange_2($a,-2);
		} else {
			$s = $a->name."身上的毒性恢复了。<br>";
			$this->cancel($a);
			StatusHelper::sky_thorne($a);	//天之王座
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
}

class Weak extends BeforeStatus {
	
	public function __construct(){
		$this->id = 21;
		$this->on = 0;		//开关
		$this->name = "衰弱";
		$this->time = 3;	//持续回合数，99即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;		
		if($this->n <= $this->time)	{
			$sp = round($a->sp * 0.25);
			$tp = round($a->tp * 0.25);
			$s = $a->name."衰弱了！（第".$this->n."回合)。<br>";
			$_SESSION['result'] .= "损失SP/TP:".$sp."/".$tp."<br>";
			$a->sp -= $sp;
			$a->tp -= $tp;
		} else {
			$s = $a->name."的衰弱恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
}

class Close extends BeforeStatus {
	
	public function __construct(){
		$this->id = 22;
		$this->on = 0;		//开关
		$this->name = "封印";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function start($a,$b,$sk) {
		return $this->action($a,$b,$sk);
	}
	
	public function action($a,$b,$sk) {
		if(CalHelper::ifgroupskill($a) == 0 && $this->n == 0) {
			$_SESSION['show'] .= "英雄の印发动，异常时效缩短一回合。<br>";
			$this->time = 2;
		}
		$this->n++;	
		if($this->n > $this->time) {
			$_SESSION['show'] .= $a->name."从".$this->name."中恢复过来。<br>";
			$this->cancel($a);
			StatusHelper::sky_thorne($a);	//天之王座
			return 0;
		}
		if(StatusHelper::conquer_abn($a)) {
			$_SESSION['show'] .= $a->name."封印中。第".$this->n."回合。<br>";
			$_SESSION['show'] .= $a->name."封印状态突破！。<br>";
			return 0;
		} else {
			$_SESSION['show'] .= $a->name."封印中。第".$this->n."回合。<br>";
			if(SkillHelper::isaskill($sk) == 1) {
				$_SESSION['show'] .= "封印状态下无法使用技能，行动取消。<br>";
				return 1;
			} else {
				return 0;
			}
		}
		
		return 0;
	}

}

class Paralysis extends BeforeStatus {
	
	public function __construct(){
		$this->id = 23;
		$this->on = 0;		//开关
		$this->name = "麻痹";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function start($a,$b) {
		return $this->action($a,$b);
	}
	
	public function action($a,$b) {
		if(CalHelper::ifgroupskill($a) == 0 && $this->n == 0) {
			$_SESSION['show'] .= "英雄の印发动，异常时效缩短一回合。<br>";
			$this->time = 2;
		}
		$this->n++;	
		if($this->n > $this->time) {
			$_SESSION['show'] .= $a->name."从".$this->name."中恢复过来。<br>";
			$this->cancel($a);
			StatusHelper::sky_thorne($a);	//天之王座
			return 0;
		}
		if(StatusHelper::conquer_abn($a)) {
			$_SESSION['show'] .= $a->name."麻痹中。第".$this->n."回合。<br>";
			$_SESSION['show'] .= $a->name."麻痹状态突破！。<br>";
			return 0;
		} else {
			$_SESSION['show'] .= $a->name."麻痹中。第".$this->n."回合。<br>";
			$_SESSION['show'] .= "麻痹状态下无法行动。<br>";
			return 1;
		}
		
		return 0;
	}
}

class Old extends BeforeStatus {

	public function __construct(){
		$this->id = 24;
		$this->on = 0;		//开关
		$this->name = "老化";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function start($a,$b) {
		return $this->action($a,$b);
	}
	
	public function action($a,$b) {
		$this->n++;	
		if($this->n > $this->time) {
			$_SESSION['show'] .= $a->name."从".$this->name."中恢复过来。<br>";
			$this->cancel($a);
			StatusHelper::sky_thorne($a);	//天之王座
			return 0;
		}
		$_SESSION['show'] .= $a->name."老化中。第".$this->n."回合。<br>";
		
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->atkskill_status[12]->cancel($a);
		$a->str += 5;
		$a->mgr += 5;
		$a->spd += 5;
		$a->vit += 5;
	}

}

class High extends BeforeStatus {
	
	public function __construct(){
		$this->id = 25;
		$this->on = 0;		//开关
		$this->name = "激昂";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function start($a,$b) {
		return $this->action($a,$b);
	}
	
	public function action($a,$b) {
		if(CalHelper::ifgroupskill($a) == 0 && $this->n == 0) {
			$_SESSION['show'] .= "英雄の印发动，异常时效缩短一回合。<br>";
			$this->time = 2;
		}
		$this->n++;	
		$tmp = mt_rand(1,100);
		if($this->n > $this->time) {
			$_SESSION['show'] .= $a->name."从".$this->name."中恢复过来。<br>";
			$this->cancel($a);
			StatusHelper::sky_thorne($a);	//天之王座
			return 0;
		}
		if(StatusHelper::conquer_abn($a) || $a->atkskill_status[14]->on == 1) {
			$_SESSION['show'] .= $a->name."激昂中。第".$this->n."回合。<br>";
			$_SESSION['show'] .= $a->name."激昂状态突破！。<br>";
			return 0;
		} else {
			$_SESSION['show'] .= $a->name."激昂中。第".$this->n."回合，自动蓄力集中<br>";
			StatusHelper::phydmgdouble($a);
			StatusHelper::mgrdmgdouble($a);
			return 1;
		}
		
		return 0;
	}

}

class Lure extends BeforeStatus {
	
	public function __construct(){
		$this->id = 26;
		$this->on = 0;		//开关
		$this->name = "魅惑";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function start($a,$sk) {
		return $this->action($a,$sk);
	}
	
	public function action($a,$sk) {
		if(CalHelper::ifgroupskill($a) == 0 && $this->n == 0) {
			$_SESSION['show'] .= "英雄の印发动，异常时效缩短一回合。<br>";
			$this->time = 2;
		}
		$this->n++;	
		if($this->n > $this->time) {
			$_SESSION['show'] .= $a->name."从".$this->name."中恢复过来。<br>";
			$this->cancel($a);
			StatusHelper::sky_thorne($a);	//天之王座
			return 0;
		}
		$_SESSION['show'] .= $a->name."魅惑中。第".$this->n."回合。<br>";
		
		return 0;
	}
	
	public function cancel($a) {
		$this->committer = "";
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->atkafter_status[3]->cancel($a);
	}
}

class Terror extends BeforeStatus {
	
	public function __construct(){
		$this->id = 27;
		$this->on = 0;		//开关
		$this->name = "恐怖";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function start($a,$b) {
		return $this->action($a,$b);
	}
	
	public function action($a,$b) {
		if(CalHelper::ifgroupskill($a) == 0 && $this->n == 0) {
			$_SESSION['show'] .= "英雄の印发动，异常时效缩短一回合。<br>";
			$this->time = 2;
		}
		$this->n++;	
		if($this->n > $this->time) {
			$_SESSION['show'] .= $a->name."从".$this->name."中恢复过来。<br>";
			$this->cancel($a);
			StatusHelper::sky_thorne($a);	//天之王座
			return 0;
		}
		if(StatusHelper::conquer_abn($a)) {
			$_SESSION['show'] .= $a->name."恐怖中。第".$this->n."回合。<br>";
			$_SESSION['show'] .= $a->name."恐怖状态突破！。<br>";
			return 0;
		} else {
			$_SESSION['show'] .= $a->name."恐怖中。第".$this->n."回合，强制防御。<br>";
 	  	  	$a->forceaction = 2;
			return 0;
		}
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;

		//防御解除
		$a->before_status[2]->n = 0;
		$a->defskill_status[3]->n = 0;
	}	

}

class Confuse extends BeforeStatus {

	public function __construct(){
		$this->id = 28;
		$this->on = 0;		//开关
		$this->name = "混乱";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function start($a,$b,$sk) {
		return $this->action($a,$b,$sk);
	}
	
	public function action($a,$b,$sk) {
		if(CalHelper::ifgroupskill($a) == 0 && $this->n == 0) {
			$_SESSION['show'] .= "英雄の印发动，异常时效缩短一回合。<br>";
			$this->time = 2;
		}
		$this->n++;	
		if($this->n > $this->time) {
			$_SESSION['show'] .= $a->name."从".$this->name."中恢复过来。<br>";
			$this->cancel($a);
			StatusHelper::sky_thorne($a);	//天之王座
			return 0;
		}
		if(StatusHelper::conquer_abn($a)) {
			$_SESSION['show'] .= $a->name."混乱中。第".$this->n."回合。<br>";
			$_SESSION['show'] .= $a->name."混乱状态突破！。<br>";
			return 0;
		} else {
			$_SESSION['show'] .= $a->name."混乱中。第".$this->n."回合。<br>";
			//1为待机，2为防御，3为随机普攻
			$a->forceaction = mt_rand(1,3);
			return 0;
		}
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->forceaction = 0;
	}	

}

class Curse extends BeforeStatus {
	public function __construct(){
		$this->id = 29;
		$this->on = 0;		//开关
		$this->name = "诅咒";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	
	public function start($a,$b,$sk) {
		return $this->action($a,$b,$sk);
	}
	
	public function action($a,$b,$sk) {
		$this->n++;	
		if($this->n > $this->time) {
			$_SESSION['show'] .= $a->name."从".$this->name."中恢复过来。<br>";
			$this->cancel($a);
			return 0;
		}
		$sk->backfire = 1;
		if(StatusHelper::conquer_abn($a)) {
			$_SESSION['show'] .= $a->name."诅咒中。第".$this->n."回合。<br>";
			$_SESSION['show'] .= $a->name."诅咒状态突破！。<br>";
			$sk->backfire = 0;
			return 0;
		} else {
			$_SESSION['show'] .= $a->name."诅咒中。第".$this->n."回合。<br>";
			if($sk->puredead == 1) $sk->ref = 1;
 	  	  	if(SkillHelper::isdmgskill($sk) == 0) {
				$_SESSION['show'] .= "诅咒中非攻击技能打消。<br>";
				return 1;
			}
			return 0;				
		}
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;

		//取消反噬
		$a->atkskill_status[7]->cancel($a);
	}
}

class FireResZero extends BeforeStatus {
	
	public function __construct(){
		$this->id = 30;
		$this->on = 0;		//开关
		$this->name = "火炎ガードキル";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
}

class IceResZero extends BeforeStatus {
	
	public function __construct(){
		$this->id = 31;
		$this->on = 0;		//开关
		$this->name = "冰结ガードキル";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
}

class WindResZero extends BeforeStatus {
	
	public function __construct(){
		$this->id = 32;
		$this->on = 0;		//开关
		$this->name = "疾风ガードキル";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
}

class ThunderResZero extends BeforeStatus {
	
	public function __construct(){
		$this->id = 33;
		$this->on = 0;		//开关
		$this->name = "电击ガードキル";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
}

class EarthResZero extends BeforeStatus {
	
	public function __construct(){
		$this->id = 34;
		$this->on = 0;		//开关
		$this->name = "地变ガードキル";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
}

class FireDef extends BeforeStatus {
	
	public function __construct(){
		$this->id = 35;
		$this->on = 0;		//开关
		$this->name = "火墙";
		$this->time = 2;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
}

class IceDef extends BeforeStatus {
	
	public function __construct(){
		$this->id = 36;
		$this->on = 0;		//开关
		$this->name = "冰墙";
		$this->time = 2;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
}

class ThunderDef extends BeforeStatus {
	
	public function __construct(){
		$this->id = 37;
		$this->on = 0;		//开关
		$this->name = "雷墙";
		$this->time = 2;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
}

class WindDef extends BeforeStatus {
	
	public function __construct(){
		$this->id = 38;
		$this->on = 0;		//开关
		$this->name = "风墙";
		$this->time = 2;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
}

class EarthDef extends BeforeStatus {
	
	public function __construct(){
		$this->id = 39;
		$this->on = 0;		//开关
		$this->name = "地墙";
		$this->time = 2;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
}

class StarGate extends BeforeStatus {
	
	public function __construct(){
		$this->id = 40;
		$this->on = 1;		//开关
		$this->name = "星の門";
		$this->time = 999;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
		$this->nohint = 1;		//当前进行次数
		$this->permanent = 1;
	}
	
	public function action($a) {
		if(CalHelper::ifgroupskill($a) == 17 && $a->ap >= 13) {
			$_SESSION['show'] .= $a->name."发动".$this->name."！<br>";
			if($a->cid == 120) {
				CalHelper::cgdisplay('xp_stargate.jpg');
			}
			$tmp = mt_rand(1,4);
			switch($tmp) {
			case 1:{StatusHelper::str_up_5($a);break;}
			case 2:{StatusHelper::mgr_up_5($a);break;}
			case 3:{StatusHelper::spd_up_5($a);break;}
			case 4:{StatusHelper::vit_up_5($a);break;}
			default:{}
			}
		}
	}
}

class StopAction extends BeforeStatus {

	public function __construct(){
		$this->id = 41;
		$this->on = 0;		//开关
		$this->name = "停止行动";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$_SESSION['show'] .= $a->name.$this->name."状态中<br>";
		$a->forceaction = 4;
		return 0;
	}
}

class BoreSkirt extends BeforeStatus {

	public function __construct(){
		$this->id = 42;
		$this->on = 0;		//开关
		$this->name = "蜃気楼";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->defskill_status[25]->cancel($a);
	}

}

//永远开启
class SDayBefore extends BeforeStatus {

	public function __construct(){
		$this->id = 43;
		$this->on = 1;		//开关
		$this->name = "特殊地形前置处理";
		$this->time = 99;	//持续回合数，99即作为永久
		$this->n = 0;		//当前进行次数
		$this->nohint = 1;
	}
	
	public function action($a) {
		if($_SESSION['T'] < 2) return 0;
		if($_SESSION['T'] == 6)	{	//巴黎圣母院大教堂
			$healhp = round($a->mxhp * 0.02);
			$a->hp = ($a->hp+$healhp>= $a->mxhp) ? $a->mxhp : $a->hp+$healhp;
			$_SESSION['result'] .= $a->name."HP恢复5%<br>";
		} elseif($_SESSION['T'] == 3)	{	//凡尔赛宫
			$_SESSION['result'] .= $a->name."SP恢复5%<br>";
			$healsp = round($a->mxsp * 0.03);
			$a->sp = ($a->sp+$healsp>= $a->mxsp) ? $a->mxsp : $a->sp+$healsp;
		} 
		return 0;
	}

	public function cancel($a) {
		return 0;
	}	

}

class AxiomShield extends BeforeStatus {

	public function __construct(){
		$this->id = 44;
		$this->on = 0;		//开关
		$this->name = "摂理の盾";
		$this->time = 1;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$_SESSION['show'] .= $this->name."发动！<br>";
		$randfunc = array('str_up_20','mgr_up_20','spd_up_20','spd_up_20');
		$rt = array_rand($randfunc);
		$rf1 = $randfunc[$rt];
		unset($randfunc[$r1]);
		$rt = array_rand($randfunc);
		$rf2 = $randfunc[$rt];
		if($r = StatusHelper::$rf1($a)) {
			$a->before_status[$r]->n += 1;
		}
		if($r = StatusHelper::$rf2($a)) {
			$a->before_status[$r]->n += 1;
		}
		$this->cancel($a);
	}

}

class IncAvoid10 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 45;
		$this->on = 0;		//开关
		$this->name = "アナライズ";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->defskill_status[4]->on = 0;
		$a->analyze = 0;
	}
}

class IncAvoid20 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 46;
		$this->on = 0;		//开关
		$this->name = "マハアナライズ";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->defskill_status[5]->on = 0;
		$a->analyze = 0;
	}

}

class SaintGuard extends BeforeStatus {
	
	public function __construct(){
		$this->id = 47;
		$this->on = 0;		//开关
		$this->name = "聖者の歌";
		$this->time = 2;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}

	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}	
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		return 0;
	}
	
}

class AllUp25 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 48;
		$this->on = 0;		//开关
		$this->name = "恒河水";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."恒河水效果第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."恒河水效果结束，能力恢复。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->str = ($a->str-$this->v>0) ? $a->str-$this->v : 0;
		$a->mgr = ($a->mgr-$this->v>0) ? $a->mgr-$this->v : 0;
		$a->spd = ($a->spd-$this->v>0) ? $a->spd-$this->v : 0;
		$a->vit = ($a->vit-$this->v>0) ? $a->vit-$this->v : 0;
		
		$a->before_status[$this->id]->time = 3;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}

}

class KuDown30 extends BeforeStatus {

	public function __construct(){
		$this->id = 49;
		$this->on = 0;		//开关
		$this->name = "苦辛";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."苦辛状态第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."的苦辛状态恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->str += $this->vs;
		$a->mgr += $this->vm;
		
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class SkyE extends BeforeStatus {
	
	public function __construct(){
		$this->id = 50;
		$this->on = 0;		//开关
		$this->name = "天の鼓動";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}	
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->defskill_status[29]->cancel($a);
	}

}

class AllUp5 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 51;
		$this->on = 0;		//开关
		$this->name = "全能力上升5";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}	
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		return 0;
	}

	public function cancel($a) {
		$a->str = ($a->str-5>0) ? $a->str-5 : 0;
		$a->mgr = ($a->mgr-5>0) ? $a->mgr-5 : 0;
		$a->spd = ($a->spd-5>0) ? $a->spd-5 : 0;
		$a->vit = ($a->vit-5>0) ? $a->vit-5 : 0;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}

}

class CrtUp extends BeforeStatus {
	
	public function __construct(){
		$this->id = 52;
		$this->on = 0;		//开关
		$this->name = "会心の予言";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}	
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->atkskill_status[14]->cancel($a);
	}

}

class ClothDown extends BeforeStatus {
	
	public function __construct(){
		$this->id = 53;
		$this->on = 0;		//开关
		$this->name = "汝の衣は無力なり";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		list($g,$pos) = CalHelper::getitbyuuid($this->committer);
		if($_SESSION[$g][$pos]->hp <= 0) {
			$_SESSION['show'] .= $_SESSION[$g][$pos]->name."死亡，".$this->name."效果立刻解除。<br>";
			$this->cancel($a);
			return  0;
		}
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的汝の衣は無力なり效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的汝の衣は無力なり效果结束。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
}

class NightA extends BeforeStatus {
	
	public function __construct(){
		$this->id = 54;
		$this->on = 0;		//开关
		$this->name = "夜のオーロラ";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		list($g,$pos) = CalHelper::getitbyuuid($this->committer);
		if($_SESSION[$g][$pos]->hp <= 0) {
			$_SESSION['show'] .= $_SESSION[$g][$pos]->name."死亡，".$this->name."效果立刻解除。<br>";
			$this->cancel($a);
			return  0;
		}
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果结束了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
}

class DevilU extends BeforeStatus {
	
	public function __construct(){
		$this->id = 55;
		$this->on = 0;		//开关
		$this->name = "魔界の調べ";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果结束了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
}

class NoWeakPoint extends BeforeStatus {
	
	public function __construct(){
		$this->id = 56;
		$this->on = 0;		//开关
		$this->name = "弱点打消";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果消失。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
}

class NTime extends BeforeStatus {
	
	public function __construct(){
		$this->id = 57;
		$this->on = 0;		//开关
		$this->name = "ノルンの瞬き";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果消失。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
	
}

class RedC extends BeforeStatus {
	
	public function __construct(){
		$this->id = 58;
		$this->on = 0;		//开关
		$this->name = "赤のカポーテ";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果消失。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->defskill_status[32]->cancel($a);
	}
	
}

class CWind extends BeforeStatus {
	
	public function __construct(){
		$this->id = 59;
		$this->on = 0;		//开关
		$this->name = "極彩の疾風";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果消失。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->spd -= 30;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->atkskill_status[21]->cancel($a);
		//$a->defskill_status[14]->cancel($a);
	}
	
}

class Leary extends BeforeStatus {

	public function __construct(){
		$this->id = 60;
		$this->on = 0;		//开关
		$this->name = "猜疑";
		$this->time = 5;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		$tmp = mt_rand(1,100);
		if($this->n <= $this->time) {
			$_SESSION['show'] .= $a->name."猜疑中。第".$this->n."回合。<br>";
			if(66 >= mt_rand(1,100)) $a->forceaction = 1;
		} else {
			$_SESSION['show'] .= $a->name."从猜疑中恢复过来。<br>";
			$this->cancel($a);
		}
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->forceaction = 0;
	}	

}

class GMalice extends BeforeStatus {

	public function __construct(){
		$this->id = 61;
		$this->on = 0;		//开关
		$this->name = "神の悪意";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time) {
			$s .= $a->name."的".$this->name."效果第".$this->n."回合。<br>";
		} else {
			$s .= $a->name."的".$this->name."效果消失。<br>";
			$this->cancel($a);
		}
		$_SESSION['show'] .= $s;
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->defafter_status[7]->cancel($a);
	}
}

class AutoHPCure1 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 62;
		$this->on = 0;		//开关
		$this->name = "小治愈促进";
		$this->time = 999;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
		$this->permanent = 1;	//持久效果
		$this->v = 20;
	}
	
	public function action($a) {
		if($a->before_status[63]->on == 1 || $a->before_status[64]->on == 1) return 0;
		if(CalHelper::is_arise($a)) $this->v = floor($this->v/2);
		$_SESSION['result'] .= $a->name."的".$this->name."效果发动，恢复".$this->v."HP<br>";
		$a->hp = ($a->hp+$this->v > $a->mxhp) ? $a->mxhp : $a->hp+$this->v;
		return 0;
	}

}

class AutoHPCure2 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 63;
		$this->on = 0;		//开关
		$this->name = "中治愈促进";
		$this->time = 999;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
		$this->permanent = 1;	//持久效果
		$this->v = 35;
	}
	
	public function action($a) {
		if($a->before_status[64]->on == 1) return 0;
		if(CalHelper::is_arise($a)) $this->v = floor($this->v/2);
		$_SESSION['result'] .= $a->name."的".$this->name."效果发动，恢复".$this->v."HP<br>";
		$a->hp = ($a->hp+$this->v > $a->mxhp) ? $a->mxhp : $a->hp+$this->v;
		return 0;
	}

}

class AutoHPCure3 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 64;
		$this->on = 0;		//开关
		$this->name = "大治愈促进";
		$this->time = 999;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
		$this->permanent = 1;	//持久效果
		$this->v = 50;
	}
	
	public function action($a) {
		$_SESSION['result'] .= $a->name."的".$this->name."效果发动，恢复".$this->v."HP<br>";
		if(CalHelper::is_arise($a)) $this->v = floor($this->v/2);
		$a->hp = ($a->hp+$this->v > $a->mxhp) ? $a->mxhp : $a->hp+$this->v;
		return 0;
	}

}

class AutoSPCure1 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 65;
		$this->on = 0;		//开关
		$this->name = "小气功";
		$this->time = 999;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
		$this->permanent = 1;	//持久效果
		$this->v = 10;
	}
	
	public function action($a) {
		if($a->before_status[66]->on == 1 || $a->before_status[67]->on == 1) return 0;
		$_SESSION['result'] .= $a->name."的".$this->name."效果发动，恢复".$this->v."SP<br>";
		$a->sp = ($a->sp+$this->v > $a->mxsp) ? $a->mxsp : $a->sp+$this->v;
		return 0;
	}

}

class AutoSPCure2 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 66;
		$this->on = 0;		//开关
		$this->name = "中气功";
		$this->time = 999;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
		$this->permanent = 1;	//持久效果
		$this->v = 20;
	}
	
	public function action($a) {
		if($a->before_status[67]->on == 1) return 0;
		$_SESSION['result'] .= $a->name."的".$this->name."效果发动，恢复".$this->v."SP<br>";
		$a->sp = ($a->sp+$this->v > $a->mxsp) ? $a->mxsp : $a->sp+$this->v;
		return 0;
	}

}

class AutoSPCure3 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 67;
		$this->on = 0;		//开关
		$this->name = "大气功";
		$this->time = 999;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
		$this->permanent = 1;	//持久效果
		$this->v = 30;
	}
	
	public function action($a) {
		$_SESSION['result'] .= $a->name."的".$this->name."效果发动，恢复".$this->v."SP<br>";
		$a->sp = ($a->sp+$this->v > $a->mxsp) ? $a->mxsp : $a->sp+$this->v;
		return 0;
	}

}

class MgrUp15 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 68;
		$this->on = 0;		//开关
		$this->name = "魔力觉醒";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name.$this->name."第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name.$this->name."状态恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->mgr = ($a->mgr-15>0) ? $a->mgr-15 : 0;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class StrUp15 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 69;
		$this->on = 0;		//开关
		$this->name = "修罗之业";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name.$this->name."第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name.$this->name."状态恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->str = ($a->str-15>0) ? $a->str-15 : 0;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}

}

class AutoTPCure3 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 70;
		$this->on = 0;		//开关
		$this->name = "ハイグロウ";
		$this->time = 999;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
		$this->permanent = 1;	//持久效果
	}
	
	public function action($a) {
		$_SESSION['result'] .= $a->name."的".$this->name."效果发动，恢复35TP<br>";
		$a->tp = ($a->tp+35 > $a->mxtp) ? $a->mxtp : $a->tp+35;
		return 0;
	}

}

class AllResTurn extends BeforeStatus {

	public function __construct(){
		$this->id = 71;
		$this->on = 0;		//开关
		$this->name = "全門耐性";
		$this->time = 4;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time) {
			$s .= $a->name."的".$this->name."效果第".$this->n."回合。<br>";
		} else {
			$s .= $a->name."的".$this->name."效果消失。<br>";
			$this->cancel($a);
		}
		$_SESSION['show'] .= $s;
		return 0;
	}
}

class TrueAllResTurn extends BeforeStatus {

	public function __construct(){
		$this->id = 72;
		$this->on = 0;		//开关
		$this->name = "真·全門耐性";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time) {
			$s .= $a->name."的".$this->name."效果第".$this->n."回合。<br>";
		} else {
			$s .= $a->name."的".$this->name."效果消失。<br>";
			$this->cancel($a);
		}
		$_SESSION['show'] .= $s;
		return 0;
	}
}

class Noluk extends BeforeStatus {

	public function __construct(){
		$this->id = 73;
		$this->on = 0;		//开关
		$this->name = "厄运";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time) {
			$s .= $a->name."的".$this->name."效果第".$this->n."回合。<br>";
		} else {
			$s .= $a->name."的".$this->name."效果解除。<br>";
			$this->cancel($a);
		}
		$_SESSION['show'] .= $s;
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->luk = (isset($a->oluk)) ? $a->oluk : 20;
	}
}

class StrUp60 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 74;
		$this->on = 0;		//开关
		$this->name = "力があふれる";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."状态第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."的".$this->name."状态恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->str = ($a->str-60>0) ? $a->str-60 : 0;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}

}

class MPrison extends BeforeStatus {
	
	public function __construct(){
		$this->id = 75;
		$this->on = 0;		//开关
		$this->name = "ミラープリズン";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."状态第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."的".$this->name."状态解除了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->atkskill_status[26]->cancel($a);
	}

}

class AllDown30 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 76;
		$this->on = 0;		//开关
		$this->name = "陰業";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name.$this->name."第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."从".$this->name."状态中恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->str += $a->dstr;
		$a->mgr += $a->dmgr;
		$a->spd += $a->dspd;
		$a->vit += $a->dvit;
		
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class LukDown20 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 77;
		$this->on = 0;		//开关
		$this->name = "运下降";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."运下降第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."运下降恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->luk += 20;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class OpenEye extends BeforeStatus {
	
	public function __construct(){
		$this->id = 78;
		$this->on = 0;		//开关
		$this->name = "黒い神の開目";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name.$this->name."第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."从".$this->name."状态中恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}

	public function cancel($a) {
		$a->str -= 30;
		$a->atkskill_status[51]->cancel($a);
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}

}

class ChaosF extends BeforeStatus {
	
	public function __construct(){
		$this->id = 79;
		$this->on = 0;		//开关
		$this->name = "混沌迷雾";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name.$this->name."第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."从".$this->name."状态中恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}

	public function cancel($a) {
		$a->defskill_status[10]->cancel($a);
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}

}

class Stone extends BeforeStatus {
	
	public function __construct(){
		$this->id = 80;
		$this->on = 0;		//开关
		$this->name = "石化";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n > $this->time) {
			$_SESSION['show'] .= $a->name."从".$this->name."中恢复过来。<br>";
			$this->cancel($a);
			return 0;
		}
		$_SESSION['show'] .= $a->name."石化中。第".$this->n."回合。<br>";
		$_SESSION['show'] .= "石化状态下无法行动。<br>";
		return 1;
	}

	public function cancel($a) {
		$a->defskill_status[30]->cancel($a);
		#$a->vit = ($a->vit-100)>0 ? $a->vit-100 : 0 ;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class AllResZero extends BeforeStatus {
	
	public function __construct(){
		$this->id = 81;
		$this->on = 0;		//开关
		$this->name = "全元素ガードキル";
		$this->time = 4;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
}

class OPrayBuff extends BeforeStatus {
	
	public function __construct(){
		$this->id = 82;
		$this->on = 0;		//开关
		$this->name = "オルレアンの祈り";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
		$this->bufftype = 0;	//能力上升类型
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."奥尔良的祈祷状态".$this->n."回合。<br>";
		}
		else {
			$s = $a->name."奥尔良的祈祷状态结束，但神恩的光芒仍笼罩在".$a->name."身上。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		switch($this->bufftype) {
			case 1:{$a->str -= 40;break;}
			case 2:{$a->mgr -= 40;break;}
			case 3:{$a->spd -= 40;break;}
			case 4:{$a->vit -= 40;break;}
			default:{break;}
		}
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class VitUp30 extends BeforeStatus {

	public function __construct(){
		$this->id = 83;
		$this->on = 0;		//开关
		$this->name = "耐上升30";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name.$this->name."第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name.$this->name."效果恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
	
	public function cancel($a) {
		$a->vit = ($a->vit-30>0) ? $a->vit-30 : 0;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}

}

class StrUp5 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 84;
		$this->on = 0;		//开关
		$this->name = "力上升5";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name.$this->name."第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name.$this->name."状态恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}

	public function cancel($a) {
		$a->str = ($a->str-5>0) ? $a->str-5 : 0;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}


class MgrUp5 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 85;
		$this->on = 0;		//开关
		$this->name = "魔上升5";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name.$this->name."第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name.$this->name."状态恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}

	public function cancel($a) {
		$a->mgr = ($a->mgr-5>0) ? $a->mgr-5 : 0;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class VitUp5 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 86;
		$this->on = 0;		//开关
		$this->name = "耐上升5";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name.$this->name."第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name.$this->name."状态恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}

	public function cancel($a) {
		$a->vit = ($a->vit-5>0) ? $a->vit-5 : 0;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class SpdUp5 extends BeforeStatus {
	
	public function __construct(){
		$this->id = 87;
		$this->on = 0;		//开关
		$this->name = "速上升5";
		$this->time = 3;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name.$this->name."第".$this->n."回合。<br>";
		}
		else {
			$s = $a->name.$this->name."状态恢复了。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}

	public function cancel($a) {
		$a->spd = ($a->spd-5>0) ? $a->spd-5 : 0;
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
	}
}

class FireResKill extends BeforeStatus {
	
	public function __construct(){
		$this->id = 88;
		$this->on = 0;		//开关
		$this->name = "火炎ガードキルEX";
		$this->time = 2;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		$_SESSION['show'] .= $s;
		
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->before_status[$this->id]->time = 2;
		$a->atkskill_status[31]->cancel($a);
	}
}

class IceResKill extends BeforeStatus {
	
	public function __construct(){
		$this->id = 89;
		$this->on = 0;		//开关
		$this->name = "氷結ガードキルEX";
		$this->time = 2;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		$_SESSION['show'] .= $s;
		
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->before_status[$this->id]->time = 2;
		$a->atkskill_status[32]->cancel($a);
	}
}

class WindResKill extends BeforeStatus {
	
	public function __construct(){
		$this->id = 90;
		$this->on = 0;		//开关
		$this->name = "疾風ガードキルEX";
		$this->time = 2;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		$_SESSION['show'] .= $s;
		
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->before_status[$this->id]->time = 2;
		$a->atkskill_status[33]->cancel($a);
	}
}

class ThunderResKill extends BeforeStatus {
	
	public function __construct(){
		$this->id = 91;
		$this->on = 0;		//开关
		$this->name = "電撃ガードキルEX";
		$this->time = 2;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		$_SESSION['show'] .= $s;
		
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->before_status[$this->id]->time = 2;
		$a->atkskill_status[34]->cancel($a);
	}
}

class EarthResKill extends BeforeStatus {
	
	public function __construct(){
		$this->id = 92;
		$this->on = 0;		//开关
		$this->name = "電撃ガードキルEX";
		$this->time = 2;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		$_SESSION['show'] .= $s;
		
		return 0;
	}

	public function cancel($a) {
		$a->before_status[$this->id]->on = 0;
		$a->before_status[$this->id]->n = 0;
		$a->before_status[$this->id]->time = 2;
		$a->atkskill_status[35]->cancel($a);
	}
}

class LightDef extends BeforeStatus {
	
	public function __construct(){
		$this->id = 93;
		$this->on = 0;		//开关
		$this->name = "光墙";
		$this->time = 2;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
}

class DarkDef extends BeforeStatus {
	
	public function __construct(){
		$this->id = 94;
		$this->on = 0;		//开关
		$this->name = "暗墙";
		$this->time = 2;	//持续回合数，999即作为永久
		$this->n = 0;		//当前进行次数
	}
	
	public function action($a) {
		$this->n++;	
		if($this->n <= $this->time)	{
			$s .= $a->name."的".$this->name."效果进入第".$this->n."回合。<br>";
		}
		else {
			$s .= $a->name."的".$this->name."效果已经解除。<br>";
			$this->cancel($a);
		}
		
		$_SESSION['show'] .= $s;
		
		return 0;
	}
}

class MoonQ extends BeforeStatus {
	public function __construct(){
		$this->id = 95;
		$this->on = 0;		//开关
		$this->name = "満月の女王";
		$this->time = 0;	//持续回合数，99即作为永久
		$this->permanent = 1;	//持久效果
		$this->nohint = 1;	//状态栏中无提示
	}
	public function action($a) {
		if($a->hp <= floor($a->mxhp * 0.25)) {
			$_SESSION['show'] .= $this->name."发动！<br>";
			StatusHelper::str_up_20($a);
			StatusHelper::mgr_up_20($a);
		}
	}
}

class NightQ extends BeforeStatus {
	
	public function __construct(){
		$this->id = 96;
		$this->on = 0;		//开关
		$this->name = "夜の女王";
		$this->time = 0;	//持续回合数，99即作为永久
		$this->permanent = 1;	//持久效果
		$this->nohint = 1;	//状态栏中无提示
	}
	
	public function action($a) {
		if($a->hp <= floor($a->mxhp * 0.25)) {
			$_SESSION['show'] .= $this->name."发动！<br>";
			StatusHelper::spd_up_20($a);
			StatusHelper::vit_up_20($a);
		}
	}
}

class BodR extends BeforeStatus {
	
	public function __construct(){
		$this->id = 97;
		$this->on = 0;		//开关
		$this->name = "観世音の済度";
		$this->time = 0;	//持续回合数，99即作为永久
		$this->permanent = 1;	//持久效果
		$this->nohint = 1;	//状态栏中无提示
	}
	
	public function action($a) {
		if($a->hp <= floor($a->mxhp * 0.2)) {
			$_SESSION['show'] .= $this->name."发动！<br>";
		} else {
			return 0;
		}
		
		if(CalHelper::is_arise($a) == false) {
			$a->before_status[17]->action($a,1);
		}
		$a->atkskill_status[53]->on = 1;
	}
}

class DragonS extends BeforeStatus {
	
	public function __construct(){
		$this->id = 98;
		$this->on = 0;		//开关
		$this->name = "極·龍脈の秘術";
		$this->time = 0;	//持续回合数，99即作为永久
		$this->permanent = 1;	//持久效果
		$this->nohint = 1;	//状态栏中无提示
	}
	
	public function action($a) {
		if($a->hp <= floor($a->mxhp * 0.2)) {
			$_SESSION['show'] .= $this->name."发动！<br>";
		} else {
			return 0;
		}
		if(CalHelper::is_arise($a) == false) {
			$a->before_status[17]->action($a,1);
		}
		$a->atkskill_status[54]->on = 1;
	}
}

?>
